package his.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import his.entity.Drugs;
import his.entity.DrugsDetailed;
import his.service.PatientSearchService;
import org.example.his.common.api.CommonResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Controller
@RequestMapping("/patient/")
public class PatientSearchController {

    @Autowired
    PatientSearchService patientSearchService;

    @GetMapping("get_drugs")
    @ResponseBody
    public CommonResponse<List<Drugs>> get_Drugs(){
        return patientSearchService.get_Drugs();
    }
    @GetMapping("get_drug_detail")
    @ResponseBody
    public CommonResponse<DrugsDetailed> get_detail(int drug_id) {
        return patientSearchService.get_detail(drug_id);
    }

    @GetMapping("search_drug")
    @ResponseBody
    public CommonResponse<Drugs> search_Drugs( @RequestParam  String KeyWord){
        return  patientSearchService.search_Drugs(KeyWord);
    }
}
